// written by entire team
/*
*/
#include "HTMLOutputter.h";
#include "Event.h"
#include "Appt.h"
#include "XMLParser.h"
#include "Filter.h"
#include "DayTime.h"
#include "DayParser.h"
#include <iostream>
#include <cctype>
#include "EventProcessor.h"
#include <sstream>
#include <cstdio>
#include "Comparator.h"

const string f = "-f";
const string empty = "";
const string space = " ";

int main(int argc, char* argv[]){
	int whichEvent = 2;
	
	//simple way of loading in multiple files
	EventProcessor process;
	string fileName;
	int temp;
	do
	{
		cout << "Enter file name"<<endl;
		cin>>fileName;
		cout <<endl<< "Is your file of 1 (Appt) or 2 (Celebrity) or 3 (Appt Type 2, eg appt_-type2.xml) " ;
		cin >> temp;
		cout << endl;
		XMLParser parser(fileName.c_str(), temp);
		process.add(parser.getEvents());
		cout<<endl<<"Enter 0 to exit, 1 to continue";
		cin>>temp;
	}while (temp!=0);
	
	
	
//	DayTime dt = DayTime(1.25);
//	DayParser dp = DayParser(20061111);
//	cout<<dt.getHour()<<endl;
//	cout<<dt.getMinute()<<endl;
//	cout<<dp.getDay()<<endl;
//	cout<<dp.getDayOfWeek()<<endl;
	cout<<"Reading file...";
//	XMLParser parser("Celebrity.xml", whichEvent);
//	vector<Event> events = parser.getEvents();
//	events.push_back(Appt(20061107, 11.26, 12.4, "beer"));
//	events.push_back(Appt(20061107, 14.26, 18.4, "beer pong"));
//	events.push_back(Appt(20061108, 11.26, 19.4, "pong of the beer"));
//	events.push_back(Appt(20061109, 21.32, 23.4, "party where i get real drunk"));
//	events.push_back(Appt(20061110, 14.50, 16.05, "hangover"));
//	events.push_back(Appt(20061110, 22.26, 23.47, "15 shots"));
//	events.push_back(Appt(20061111, .30, 14.41, "emergency room"));
//	events.push_back(Appt(20061108, 0.0, 23.59, "the day i drink all day"));
	cout<<"done."<<endl;
	/*some tests
	sort(testEvents.begin(), testEvents.end(), Comparitor<Event> (new Sorter<Event>()));
	for(unsigned int k = 0; k< testEvents.size()-1; k++)
	{
		Event a = testEvents.at(k);
		cout << a.getDay() << space << a.getDescription()<<endl;
		cout << " is same as next Event ";
		if(a==testEvents[k+1])
			cout << "true";
		else cout << "false";
		cout << endl;
	}
	*/
	cout<<"Processing...";
	HTMLOutputter out;
	//EventProcessor process(events);
	cout<<"done." << endl;
	
	cout<<"Outputting...";
	process.generateHTML(out);
	cout<<"done."<<endl;
	cout<<"Program completed."<<endl;
	
	return 0;
}
